﻿<ul class="nav navbar-nav navbar-right">
    <li>@(Request.IsAuthenticated ? Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Управление" }) : null)</li>
    <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Учетная запись<b class="caret"></b></a>
        @if (Request.IsAuthenticated)
        {

            <ul class="dropdown-menu">
                <li><a href="#">Пользователи</a></li>
                <li><a href="#">Роли</a></li>
                <li class="divider"></li>
                <li style="background-color: salmon"><a href="javascript:document.getElementById('logoutForm').submit()">Выйти</a></li>
            </ul>
            <span style="visibility: collapse">
                @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
                {
                    @Html.AntiForgeryToken()
                }
            </span>
        }
        else
        {
            <ul class="dropdown-menu">
                <li>@Html.ActionLink("Регистрация", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
                <li>@Html.ActionLink("Выполнить вход", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
            </ul>
        }
    </li>
</ul>